package com.square.service.member.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.R;
import com.square.service.common.entity.member.po.User;
import com.square.service.common.handler.ApiCode;
import com.square.service.member.provider.mapper.UserMapper;
import com.square.service.member.provider.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author : 王苏
 * @since : 2021/4/20 14:03
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    /**
     * 通过用户名获取用户
     *
     * @param username
     * @return
     */
    @Override
    public R<?> getUserByUsername(String username) {
        User user = userMapper.getUserByUsername(username);
        if(user == null){
            return R.failed(ApiCode.RESULT_NULL_POINT_EXCEPTION);
        }
        return R.ok(user);
    }
}
